// component/tab-class/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    addBuy(e){
      let  {type}   =  e.currentTarget.dataset||{};
      if(type){
        this.triggerEvent("addBuy",type);
      }
    },
    goTo(e){
      let { type } = e.currentTarget.dataset || {},toUrl   = (url)=>{wx.switchTab({url:url})}
      console.log("当前type",type)
      switch(type){
         case "1":toUrl("/pages/index/index");break
         case "2":toUrl("/pages/cart/cart");break
      }
    }
  }
})
